package com.tj.bo.trade.client.request;

import com.fqgj.common.api.ParamsObject;
import com.tj.bo.common.conf.util.ParamsValidateUtil;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @program: binary-option
 * @description
 * @author: binary
 * @create: 2020-06-05 14:41
 **/
public class CreateTradeRequestRO extends ParamsObject {

    private static final long serialVersionUID = 1733384104830029194L;

    /**
     *客户号
     */
    private String userCode;
    /**
     *产品code BCHUSD,GBPJPY,EURJPY
     */
    private String productCode;
    /**
     *下单周期，如60s 180s 300s
     */
    private Integer productPeriod;
    /**
     *初始产品利润率
     */
    private BigDecimal profit;
    /**
     * 最终结算利润率
     */
    private BigDecimal settlementProfit;
    /**
     * 订单类型 0:虚拟订单 1:真实订单
     */
    private Integer tradeType;
    /**
     * 下单趋势，0:压跌 1:压涨
     */
    private Integer trendType;
    /**
     * 货币类型 0:INR
     */
    private Integer coinType;
    /**
     *下单金额
     */
    private BigDecimal amount;
    /**
     *开盘时间
     */
    private Date openingTime;
    /**
     *开盘价格
     */
    private BigDecimal openingPrice;

    public BigDecimal getSettlementProfit() {
        return settlementProfit;
    }

    public CreateTradeRequestRO setSettlementProfit(BigDecimal settlementProfit) {
        this.settlementProfit = settlementProfit;
        return this;
    }

    public BigDecimal getProfit() {
        return profit;
    }

    public CreateTradeRequestRO setProfit(BigDecimal profit) {
        this.profit = profit;
        return this;
    }

    public String getUserCode() {
        return userCode;
    }

    public CreateTradeRequestRO setUserCode(String userCode) {
        this.userCode = userCode;
        return this;
    }

    public String getProductCode() {
        return productCode;
    }

    public CreateTradeRequestRO setProductCode(String productCode) {
        this.productCode = productCode;
        return this;
    }

    public Integer getProductPeriod() {
        return productPeriod;
    }

    public CreateTradeRequestRO setProductPeriod(Integer productPeriod) {
        this.productPeriod = productPeriod;
        return this;
    }

    public Integer getTradeType() {
        return tradeType;
    }

    public CreateTradeRequestRO setTradeType(Integer tradeType) {
        this.tradeType = tradeType;
        return this;
    }

    public Integer getTrendType() {
        return trendType;
    }

    public CreateTradeRequestRO setTrendType(Integer trendType) {
        this.trendType = trendType;
        return this;
    }

    public Integer getCoinType() {
        return coinType;
    }

    public CreateTradeRequestRO setCoinType(Integer coinType) {
        this.coinType = coinType;
        return this;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public CreateTradeRequestRO setAmount(BigDecimal amount) {
        this.amount = amount;
        return this;
    }

    public Date getOpeningTime() {
        return openingTime;
    }

    public CreateTradeRequestRO setOpeningTime(Date openingTime) {
        this.openingTime = openingTime;
        return this;
    }

    public BigDecimal getOpeningPrice() {
        return openingPrice;
    }

    public CreateTradeRequestRO setOpeningPrice(BigDecimal openingPrice) {
        this.openingPrice = openingPrice;
        return this;
    }

    @Override
    public void validate() {
        ParamsValidateUtil.checkParams(StringUtils.isBlank(userCode) , "userCode can't be empty");
        ParamsValidateUtil.checkParams(StringUtils.isBlank(productCode) , "productCode can't be empty");
        ParamsValidateUtil.checkParams(productPeriod == null , "productPeriod can't be empty");
        ParamsValidateUtil.checkParams(tradeType == null , "tradeType can't be empty");
        ParamsValidateUtil.checkParams(coinType == null , "coinType can't be empty");
        ParamsValidateUtil.checkParams(amount == null , "amount can't be empty");
        ParamsValidateUtil.checkParams(openingTime == null , "openingTime can't be empty");
        ParamsValidateUtil.checkParams(openingPrice == null , "openingPrice can't be empty");
    }
}
